import java.util.Scanner;
public class Test5 {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        int j=0,s=2,k=1;
        if(n==1){System.out.println(2);}
        else {
        for(int m=3;k<n;m++){
        for(int i=2;i<m;i++){
            if(m%i==0){
                j++;
            break;}
        }if(j==0){s+=m;
                k++;}
        j=0;}
        System.out.println(s);}
        scanner.close();
    }
}